var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		pagId : 'paging',
		l_column : [{
			colkey : "create_time",
			name : "日期"
		}, {
			colkey : "cname",
			name : "客户"
		}, {
			colkey : "oname",
			name : "产品名称"
		}, {
			colkey : "material_code",
			name : "物料编码"
		}, {
			colkey : "warehouse",
			name : "仓位"
		}, {
			colkey : "number",
			name : "生产订单数"
		}, {
			colkey : "numberOfStorage",
			name : "入库数"
		}, {
			colkey : "pfinishtime",
			name : "生产结束时间"
		}, {
			colkey : "orderPack",
			name : "每包件数"
		}, {
			colkey : "packNum",
			name : "订单包数"
		}, {
			colkey : "finalEnterDate",
			name : "最后入库日期"
		}, {
			colkey : "storageDay",
			name : "已入库天数",
			renderData : function(rowindex,data, rowdata, column) {
				if ((data>=0 &&data<=3) || (data>="0" && data<="3")){
					return data;
				}else if ((data>=4 &&data<=7) || (data>="4" && data<="7")){
					return "<font color='lightgreen'>"+data+"</font>";
				}else if ((data>=8 &&data<=15) || (data>="8" && data<="15")){
					return "<font color='orange'>"+data+"</font>";
				}else if ((data>=16 &&data<=30) || (data>="16" && data<="30")){
					return "<font color='brown'>"+data+"</font>";
				}else if ((data>=31 &&data<=90) || (data>="31" && data<="90")){
					return "<font color='blue'>"+data+"</font>";
				}else if (data>90){
					return "<font color='red'>"+data+"</font>";
				}else{
					return "未完成生产";
				}
			}
		} ],
		jsonUrl : rootPath
				+ '/enterstorage_form/enterstorage_form_findByPage.shtml',
		dymCol : true,
		checkbox : true,
		serNumber : false
	});
	$("#editFun").click("click", function() {
		editAccount();
	});
	$("#search").click("click", function() {//  绑定查询按扭
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});

});
function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1 || cbox == "") {
		 layer.msg("只能选中一个");
		 return;
	}
	pageii = layer.open({
		title : "编辑入库报表",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath
				+ '/enterstorage_form/enterstorage_form_edit.shtml?id=' + cbox
	});
}







